AssetApi

interface AssetApi

Functions

Link copied to clipboard
abstract fun addAsset(sourceId: String, asset: AssetDefinition)

Adds the given asset to a local asset source.

Link copied to clipboard
abstract fun addLocalSource(sourceId: String, supportedMimeTypes: List<String>, applyAsset: suspend (Asset) -> DesignBlock?? = null, applyAssetToBlock: suspend (Asset, DesignBlock) -> Unit? = null)

Adds a local asset source. Its ID has to be unique.

Link copied to clipboard
abstract suspend fun addLocalSourceFromJSON(contentUri: Uri, matcher: List<String>? = null): String

Creates a new local asset source from a JSON Uri.

abstract fun addLocalSourceFromJSON(contentJSON: String, basePath: String? = null, matcher: List<String>? = null): String

Creates a new local asset source from a JSON string containing asset definitions.

Link copied to clipboard
abstract fun addSource(source: AssetSource)

Adds a custom asset source. Its ID has to be unique.

Link copied to clipboard
abstract suspend fun applyAssetSourceAsset(sourceId: String, asset: Asset): DesignBlock?

Applies an asset to the active scene using custom AssetSource.applyAsset function.

abstract suspend fun applyAssetSourceAsset(sourceId: String, asset: Asset, block: DesignBlock)

Applies an asset to the block using custom AssetSource.applyAsset function.

Link copied to clipboard
abstract suspend fun applyAssetSourceProperty(sourceId: String, asset: Asset, property: AssetProperty)

Apply an asset property.

Link copied to clipboard
abstract fun assetSourceContentsChanged(sourceId: String)

Notifies the engine that the contents of an asset source changed.

Link copied to clipboard
abstract suspend fun defaultApplyAsset(asset: Asset): DesignBlock?

This is the default implementation of applying asset to the active scene. This means a design block is instantiated and configured according to the Asset.meta properties.

abstract suspend fun defaultApplyAsset(asset: Asset, block: DesignBlock)

This is the default implementation of applying asset object to an existing block. This means it replaces the block content with asset content, if compatible.

Link copied to clipboard
abstract suspend fun fetchAsset(sourceId: String, assetId: String, options: FetchAssetOptions = FetchAssetOptions()): Asset?

Fetch a specific asset by ID from an asset source.

Link copied to clipboard
abstract fun findAllSources(): List<String>

Finds all registered asset sources.

Link copied to clipboard
abstract suspend fun findAssets(sourceId: String, query: FindAssetsQuery): FindAssetsResult

Finds assets of a given type in a specific asset source.

Link copied to clipboard
abstract fun getCredits(sourceId: String): AssetCredits?

Queries the asset source's credits info.

Link copied to clipboard
abstract suspend fun getGroups(sourceId: String): List<String>?

Queries the asset source's groups for a certain asset type.

Link copied to clipboard
abstract fun getLicense(sourceId: String): AssetLicense?

Queries the asset source's license info.

Link copied to clipboard
abstract fun getSourceSupportedMimeTypes(sourceId: String): List<String>

Get the asset source's list of supported mime types.

Link copied to clipboard
abstract fun onAssetSourceAdded(): Flow<String>

Subscribe to asset source addition events.

Link copied to clipboard
abstract fun onAssetSourceRemoved(): Flow<String>

Subscribe to asset source removal events.

Link copied to clipboard
abstract fun onAssetSourceUpdated(): Flow<String>

Subscribe to asset source's content update events.

Link copied to clipboard
abstract fun removeAsset(sourceId: String, assetId: String)

Removes the specified asset from its local asset source.

Link copied to clipboard
abstract fun removeSource(sourceId: String)

Removes an asset source with the given ID.